package com.dingpeikeji.quickdeer.modules.ordersettle.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dingpeikeji.quickdeer.core.common.persistence.Page;
import com.dingpeikeji.quickdeer.core.common.service.CrudService;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.Office;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.User;
import com.dingpeikeji.quickdeer.core.modules.sys.utils.UserUtils;
import com.dingpeikeji.quickdeer.modules.ordersettle.entity.TOrdersSettle;
import com.dingpeikeji.quickdeer.modules.ordersettle.dao.TOrdersSettleDao;

/**
 * 客运公司申请结算表Service
 * @author mash
 * @version 2017-03-13
 */
@Service
@Transactional(readOnly = true)
public class TOrdersSettleService extends CrudService<TOrdersSettleDao, TOrdersSettle> {

	public TOrdersSettle get(String id) {
		return super.get(id);
	}
	
	public List<TOrdersSettle> findList(TOrdersSettle tOrdersSettle) {
		return super.findList(tOrdersSettle);
	}
	
	public Page<TOrdersSettle> findPage(Page<TOrdersSettle> page, TOrdersSettle tOrdersSettle) {
		return super.findPage(page, tOrdersSettle);
	}
	
	@Transactional(readOnly = false)
	public void save(TOrdersSettle tOrdersSettle) {
		User user = UserUtils.getUser();	
			
		tOrdersSettle.setCreateBy(user);
		tOrdersSettle.setOfficeid(user.getOffice());
		super.save(tOrdersSettle);
		//更新结算状态
		dao.settleorder(tOrdersSettle);
	}
	
	@Transactional(readOnly = false)
	public void confirmsave(TOrdersSettle tOrdersSettle) {
		dao.confirmsave(tOrdersSettle);
	}
	
	@Transactional(readOnly = false)
	public void checksave(TOrdersSettle tOrdersSettle) {
		dao.checksave(tOrdersSettle);
	}
	
	@Transactional(readOnly = false)
	public void rcptsave(TOrdersSettle tOrdersSettle) {
		dao.rcptsave(tOrdersSettle);
	}
	
	
	@Transactional(readOnly = false)
	public void delete(TOrdersSettle tOrdersSettle) {
		super.delete(tOrdersSettle);
	}
	
}